package base.集合;

import java.util.Map;
import java.util.TreeMap;

public class Treemap {
    public static void main(String[] args) {
        TreeMap<girlfriend,String> tm = new TreeMap<>();
        girlfriend g1 = new girlfriend("小丹丹",16);
        girlfriend g2 = new girlfriend("小诗诗",17);
        girlfriend g3 = new girlfriend("小灰灰",18);
        tm.put(g1,"广东");
        tm.put(g2,"浙江");
        tm.put(g3,"陕西");
        System.out.println(tm);

        for (Map.Entry<girlfriend,String> entry : tm.entrySet()){
            System.out.println(entry.getKey()+":"+entry.getValue());
        }
    }
}



